<!-- 地址详情弹窗 -->
<template>
            <a-form
                    ref="form3"
                    class="ele-form-detail"
                    :model="addressModalApp.address"
                    :label-col="{md: {span: 2}, sm: {span: 4}, xs: {span: 6}}"
                    :wrapper-col="{md: {span: 22}, sm: {span: 20}, xs: {span: 18}}">
                <a-descriptions :title="addressModalApp.title" bordered>
                                    <a-descriptions-item label="标识">
                        {{ addressModalApp.address.Eid }}
                    </a-descriptions-item>
                                    <a-descriptions-item label="创建人">
                        {{ addressModalApp.address.creatorName }}
                    </a-descriptions-item>
                                    <a-descriptions-item label="名称">
                        {{ addressModalApp.address.name }}
                    </a-descriptions-item>
                                    <a-descriptions-item label="地址简称">
                        {{ addressModalApp.address.addressAbbreviation }}
                    </a-descriptions-item>
                                    <a-descriptions-item label="地址类别">
                        {{ addressModalApp.address.addressType }}
                    </a-descriptions-item>
                                    <a-descriptions-item label="业务id">
                        {{ addressModalApp.address.businessID }}
                    </a-descriptions-item>
                                    <a-descriptions-item label="详细地址">
                        {{ addressModalApp.address.detailedAddress }}
                    </a-descriptions-item>
                                    <a-descriptions-item label="省">
                        {{ addressModalApp.address.province }}
                    </a-descriptions-item>
                                    <a-descriptions-item label="市">
                        {{ addressModalApp.address.city }}
                    </a-descriptions-item>
                                    <a-descriptions-item label="区县">
                        {{ addressModalApp.address.district }}
                    </a-descriptions-item>
                                    <a-descriptions-item label="街道地址">
                        {{ addressModalApp.address.streetAddress }}
                    </a-descriptions-item>
                                    <a-descriptions-item label="地址经度">
                        {{ addressModalApp.address.addressLongitude }}
                    </a-descriptions-item>
                                    <a-descriptions-item label="地址纬度">
                        {{ addressModalApp.address.addressLatitude }}
                    </a-descriptions-item>
                                    <a-descriptions-item label="邮编">
                        {{ addressModalApp.address.zipCode }}
                    </a-descriptions-item>
                                    <a-descriptions-item label="状态">
                        {{ addressModalApp.address.status }}
                    </a-descriptions-item>
                                    <a-descriptions-item label="创建人ID">
                        {{ addressModalApp.address.creatorId }}
                    </a-descriptions-item>
                                    <a-descriptions-item label="备注">
                        {{ addressModalApp.address.remark }}
                    </a-descriptions-item>
                                    <a-descriptions-item label="创建时间">
                        {{ addressModalApp.address.createDatetime }}
                    </a-descriptions-item>
                                </a-descriptions>
            </a-form>
</template>

<script>
    import {defineComponent, reactive, onMounted, inject} from "vue";
    import {useRoute} from "vue-router"
    import {AddressService} from "@/views/restaurant/sale/address/addressService";

    export default defineComponent({
        setup() {
            const route = useRoute();
            let routeId = route.params.id;
            let addressListApp = inject('addressListApp', reactive({}));
            const addressModalApp = reactive({id: null, address: {}, display: false});

            onMounted(() => {
                    addressModalApp.address = {};
                if (routeId) {
                        addressModalApp.id = routeId;
                } else if (addressListApp.viewModalShowing) {
                        addressModalApp.id = addressListApp.currentId;
                        addressModalApp.display = true;
                }
                if (addressModalApp.id) {
                    getInfo(addressModalApp.id);
                }
            })

            const getInfo = (id) => {
                    AddressService.findAddress(id).then((res) => {
                            addressModalApp.address = res.data;
                            addressModalApp.title = "查看 " + addressModalApp.address.name;
                })
            }

            return {
                    addressModalApp,
                routeId,
                getInfo,
            }
        }
    })
</script>

<style scoped>
</style>

